package com.Algorithm.HUAWEI.three20220323;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/04/15/17:01
 * @Description:
 * @Target:
 */
public class 高精度整数加法 {
    /*
    *
    * 描述
    输入两个用字符串 str 表示的整数，求它们所表示的数之和。

    数据范围： 1≤len(str)≤10000
    输入描述：
    输入两个字符串。保证字符串只含有'0'~'9'字符

    输出描述：
    输出求和后的结果

    示例1
    输入：
    9876543210
    1234567890

    输出：
    11111111100

    *
    * */


    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String ss1 = in.readLine();
        String ss2 = in.readLine();

        int index1 = ss1.length();
        int index2 = ss2.length();

        int yiChu = 0;

        StringBuffer stringBuffer = new StringBuffer();
        while (index1>0&&index2>0){
            int sum = 0;

            sum = yiChu+(ss1.charAt(--index1)-'0')+(ss2.charAt(--index2)-'0');
            if(sum>=10){
                yiChu=sum/10;
                stringBuffer.append(sum%10);
            }else {
                yiChu = 0;
                stringBuffer.append(sum);
            }


        }

        stringBuffer.reverse();


        if (index1>0){
            System.out.print(process(ss1.substring(0,index1),yiChu));
        }else {
            System.out.print(process(ss2.substring(0,index2),yiChu));
        }
        System.out.print(stringBuffer.toString());


    }


    static String process(String ss,int yiChu){
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = ss.length()-1; i >= 0; i--) {
            int sum = 0;

            sum = yiChu+(ss.charAt(i)-'0');
            if(sum>=10){
                yiChu=sum/10;
                stringBuffer.append(sum%10);
            }else {
                yiChu = 0;
                stringBuffer.append(sum);
            }
        }

        if (yiChu!=0){
            stringBuffer.append(yiChu);
            System.out.println(yiChu);
        }

        return stringBuffer.reverse().toString();
    }
}
